import java.io.File;
import java.io.FileFilter;
import java.util.Iterator;

public class SourceIterator implements Iterator<File>
{
	File path;
	File[] source;
	int curSource = 0;

	public SourceIterator(File path)
	{
		this.path = path;

		FileFilter sourceFilter = new FileFilter()
		{
			public boolean accept(File file)
			{
				if (file.getName().toLowerCase().endsWith(".java")
						|| file.getName().toLowerCase().endsWith(".class"))
					return true;
				return false;
			}
		};

		source = SearchDir.get(path, sourceFilter);
	}

	public boolean hasNext()
	{
		if (curSource < source.length)
			return true;
		return false;
	}

	public File next()
	{
		return source[curSource++];
	}

	public void remove()
	{
	}

}
